﻿namespace Pp.Core
{
    public class Result
    {
        public bool Success { get; set; }
        public string Error { get; set; }

        public static Result AsSuccess()
        {
            return new Result { Success = true };
        }
        public static Result AsError(string error)
        {
            return new Result { Success = false, Error = error };
        }
    }
    public class Result<T>
    {
        public bool Success { get; set; }
        public string Error { get; set; }
        public T Data { get; set; }
        public static Result<T> AsSuccess(T data)
        {
            return new Result<T> { Success = true, Data = data, Error = "" };
        }
        public static Result<T> AsError(string error)
        {
            return new Result<T> { Success = false, Error = error, Data = default(T) };
        }
    }
}
